﻿<UserControl x:Class="Supremacy.Client.Views.ColonyShipyardBuildListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:scc="http://schemas.startreksupremacy.com/xaml/presentation">
  <ListView x:Name="BuildList"
            Background="Transparent"
            Padding="0"
            Margin="0"
            BorderBrush="{x:Null}"
            BorderThickness="0"
            FontFamily="{StaticResource {x:Static scc:ClientResources.DefaultFontFamilyKey}}"
            FontSize="12pt"
            ItemsSource="{Binding Path=ShipyardBuildProjects, Mode=OneWay}"
            SelectedItem="{Binding Path=Model.SelectedShipyardBuildProject, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type scc:ColonyScreenView}}}"
            PreviewMouseLeftButtonDown="OnBuildListPreviewMouseLeftButtonDown"
            TextSearch.TextPath="Description">
    <ListView.Resources>
      <DataTemplate x:Key="BuildListItemTemplate">
        <DockPanel LastChildFill="True"
                   Margin="4,3,4,3"
                   Background="Transparent"
                   IsHitTestVisible="True">
          <TextBlock x:Name="TurnEstimateText"
                     DockPanel.Dock="Right"
                     HorizontalAlignment="Right"
                     Foreground="{StaticResource {x:Static scc:ClientResources.HeaderTextForegroundBrushKey}}">
            <TextBlock Text="{Binding Path=TurnsRemaining}" />
            <TextBlock x:Name="TurnsText"
                       Text="Turns" />
          </TextBlock>
          <TextBlock x:Name="BuildDesignName"
                     Foreground="{StaticResource {x:Static scc:ClientResources.HeaderTextForegroundBrushKey}}"
                     Text="{Binding Path=Description}" />
        </DockPanel>
        <DataTemplate.Triggers>
          <DataTrigger Binding="{Binding Path=TurnsRemaining}"
                       Value="1">
            <Setter TargetName="TurnsText"
                    Property="Text"
                    Value="Turn" />
          </DataTrigger>
          <DataTrigger Binding="{Binding Path=IsUpgrade}"
                       Value="True">
            <Setter TargetName="BuildDesignName"
                    Property="Foreground"
                    Value="{StaticResource {x:Static scc:ClientResources.DefaultTextForegroundBrushKey}}" />
          </DataTrigger>
        </DataTemplate.Triggers>
      </DataTemplate>
    </ListView.Resources>
    <ListView.ItemTemplate>
      <StaticResource ResourceKey="BuildListItemTemplate" />
    </ListView.ItemTemplate>
  </ListView>
</UserControl>